package route

import (
	"github.com/gin-gonic/gin"
	"nnxy-search-api/search-order-api/api/order"
	"nnxy-search-api/search-order-api/middleware"
)

func InitOrderRoute(router *gin.RouterGroup) {
	r := router.Group("order")
	{
		r.GET("", order.List) // 获取订单列表
		r.GET("/:id", order.Detail)
	}
	orderRoute := router.Group("order").Use(middleware.JwtAuth())
	{

		orderRoute.GET("me", order.MeList)      // 获取订单列表
		orderRoute.GET("math", order.MathList)  // 获取匹配订单列表
		orderRoute.POST("math/*id", order.Math) // 获取匹配订单列表
		orderRoute.POST("", order.New)
		orderRoute.PUT("/:id", order.Update)
		orderRoute.DELETE("/:id", order.Delete)
		orderRoute.POST("check/:id", order.CheckClaim)
		orderRoute.POST("claim/:id", order.Claim)
	}
}
